package com.trendit.print.sdk.models.soundbox;

import com.trendit.print.sdk.DaquObject;
import com.trendit.print.sdk.DaquRequest;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

public class DoPlayRequest implements DaquRequest<DoPlayResponse> {

    private DaquObject bizModel;

    /**
     * 构造方法
     *
     * @param bizModel
     */
    public DoPlayRequest(DoPlayRequest.Model bizModel) {
        this.bizModel = bizModel;
    }


    @Override
    public String getApiMethodName() {
        return "openapi.play";
    }

    @Override
    public String getApiVersion() {
        return "1.0";
    }

    @Override
    public String getNotifyUrl() {
        return null;
    }

    @Override
    public String getApiMethodURL() {
        return "/openapi/speaker/play";
    }

    @Override
    public Class<DoPlayResponse> getResponseClass() {
        return DoPlayResponse.class;
    }

    @Override
    public DaquObject getBizModel() {
        return bizModel;
    }

    @Override
    public String getBizContent() {
        return null;
    }

    @Data
    public static class Model extends DaquObject {

        /**
         * 设备编码
         */
        @NotBlank(message = "设备编号不能为空")
        private String sn;

        /**
         * 业务单号(外部系统)
         */
        private String orderId;

        /**
         * 超时时间：秒
         */
        @Min(10)
        @Max(120)
        private int expiredSec;

        /**
         * 文本内容
         */
        private List<VoiceText> contentList;

        @Data
        public static class VoiceText {
            /**
             * 1: General text; 2: Receipt amount; 3: Arabic numerals
             */
            @NotNull
            private Integer type;

            @NotNull
            private String value;
        }

    }


}
